package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.entities.CommonResult;
import com.atguigu.springcloud.entities.Payment;
import com.atguigu.springcloud.service.IOrderFeignService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
public class OrderFeignController {
    @Resource
    IOrderFeignService orderFeignService;

    @GetMapping("/open-feign/consumer/payment/get/{id}")
    public CommonResult<Payment> getPayment(@PathVariable("id") Long id) {
        CommonResult<Payment> payment = orderFeignService.getPayment(id);
        return payment;
    }


    @PostMapping("/open-feign/consumer/payment/create")
    public CommonResult<Payment> getPaymentById(@RequestBody Payment payment) {
        CommonResult<Payment> paymentCommonResult = orderFeignService.create(payment);
        return paymentCommonResult;
    }


    @GetMapping("/open-feign/consumer/payment/time-out")
    public String testTimeOut() {
        return orderFeignService.testTimeOut();
    }


}
